Txt2Site Website Builder
Using markup Creole
Creole (aka WikiCreole) is a lightweight markup language, aimed at being a common markup language for wikis. Creole was designed by comparing major wiki engines and using the most common markup for a particular wikitext element. Version 1.0 (final) of Creole was released on 4 July 2007. Link: Creole 1.0 Homepage.
This page describes the syntax of Creole as it is implemented in the Perl module Text::WikiCreole.
Txt2Site uses this module to convert Creole to XHTML and to implement plugins.
This page is completely written with Creole. See the source if you are curious as how it is done.
Creole | What you see | HTML code |
---|---|---|
//italics// | italics | <em> italics </em> |
**bold** | bold | <strong> bold </strong> |
Link to [[Wikipage]] | Link to Wikipage | Link to <a href="Wikipage"> Wikipage </a> |
[[ URL | Linkname ]] | Linkname | <a href="URL"> Linkname </a> |
No Linebreak! Use empty line |
No Linebreak! Use empty line |
No Linebreak! <br /> <br /> Use empty line <br /> |
Force \\\ Linebreak | Force Linebreak |
Force <br /> Linebreak |
{{ ${path_to_root}include/images/canstock1.jpg | Lion }} | ![]() |
<img src="include/images/canstock1.jpg" alt="Lion" /> |
Headings begin with a equal sign = at the beginning of a line. Closing (right-side) equal signs are optional, don't need to be balanced and don't impact the kind of heading generated. Whitespace is allowed before the left-side equal signs. Only whitespace characters are permitted after the closing equal signs. Markup parsing is done within headings.
= Level 1 (largest) = == Level 2 == === Level 3 === ==== Level 4 ==== ===== Level 5 ===== ====== Level 6 ====== === Also level 3 === Also level 3 = === Also level 3 == === //Italic// heading ===
<h1>Level 1 (largest)</h1> <h2>Level 2</h2> <h3>Level 3</h3> <h4>Level 4</h4> <h5>Level 5</h5> <h6>Level 6</h6> <h3>Also level 3</h3> <h3>Also level 3</h3> <h3>Also level 3</h3> <h3> //Italic// heading </h3>
Links can appear in paragraphs (also inside bold and italic text), list items and table cells. The links are bold or italic if they are part of bold or italic text. Images inside links are supported. Link titles are parsed for other markup within a link.
[[#anchorname]] [[#anchorname | Go to Anchor]] [[MyBigPage | Go to my page]] [[http://www.wikicreole.org/]] http://www.wikicreole.org/ [[http://www.wikicreole.org/ | Visit the WikiCreole website]] [[New_Stuff_Page | **New** //Stuff//]] Image link: [[MyBigPage | {{ ${path_to_root}include/images/smiley.gif | Smiley }} ]]
#anchorname
Go to Anchor
Go to my page
http://www.wikicreole.org/
http://www.wikicreole.org/
Visit the WikiCreole website
New Stuff
Image link:
<a href="#anchorname">#link</a> <a href="#anchorname"> Go to Anchor</a> <a href="MyBigPage">Go to my page</a> <a href="http://www.wikicreole.org">http://www.wikicreole.org</a> <a href="http://www.wikicreole.org">http://www.wikicreole.org</a> <a href="http://www.wikicreole.org">Visit the WikiCreole website</a> <a href="New_Stuff_Page"><strong>New</strong> <em>Stuff</em></a> Image link: <a href="MyBigPage"><img src="include/images/smiley.gif" alt="Smiley" /></a>
One or more blank lines end paragraphs. A list, table or nowiki block end paragraphs too.
This is my text. This is more text.
This is my text.
This is more text.
<p>This is my text.</p> <p>This is more text.</p>
Line breaks can be forced by typing three backslashes: \\\ .
The Creole specifications prescribes two backslashes. Because Txt2Site uses the backslash as an escape character, the line break is forced by typing three backslashes. See section Escape Characters.
This is the first line,\\\and this is the second.
This is the first line,
and this is the second.
This is the first line,<br /> and this is the second.
List items begin with a * or a # at the beginning of a line. Whitespace is optional before and after the * or # characters, however a space is required afterwards if the list element starts with bold text.
A list item ends at the line which begins with a * or a # character (next item or sublist), blank line, heading, table, or nowiki block; like paragraphs, it can span multiple lines and contain line breaks forced with \\\.
Bold, italics, links, and nowiki can be used in list items, but they cannot span several list items.
A line starting with ** (including optional whitespace before and afterwards), immediately following any list element on a line above, will be treated as a nested unordered list element. Otherwise it will be treated as the beginning of bold text.
* Item 1 ** Item 1.1 ** Item 1.2 * Item 2
<ul> <li>Item 1</li> <ul> <li>Item 1.1</li> <li>Item 1.2</li> </ul> <li>Item 2</li> </ul>
# Item 1 ## Item 1.1 ## Item 1.2 # Item 2
<ol> <li>Item 1</li> <ol> <li>Item 1.1</li> <li>Item 1.2</li> </ol> <li>Item 2</li> </ol>
A horizontal rule is created by at least four hyphens. Whitespace is optional before and after the hyphens, but no whitespace is allowed between them. The four hyphens must be the only characters (other than whitespace) on that line.
----
<hr />
{{${path_to_root}include/images/canstock1.jpg | lion image}}
<img src="include/images/canstock1.jpg" alt="lion image" />
All cells are separated by single pipes (|). Leading spaces are permitted before the first cell of a row and trailing spaces are permitted at the end of a line. The ending pipe is optional. You can embed links, bold, italics, line breaks, images and nowiki in table cells.
Equal sign directly following pipe (|=) defines a header. Headers can be arranged horizontally or vertically.
|= Heading Col 1 |= Heading Col 2 | | Cell 1.1 | Two lines\\in Cell 1.2 | | Cell 2.1 | Cell 2.2 |
Heading Col 1 | Heading Col 2 |
---|---|
Cell 1.1 | Two lines in Cell 1.2 |
Cell 2.1 | Cell 2.2 |
<table class="table_creole" > <tr> <th>Heading Col 1</th> <th>Heading Col 2</th> </tr> <tr> <td>Cell 1.1</td> <td>Two lines<br />in Cell 1.2</td> </tr> <tr> <td>Cell 2.1</td> <td>Cell 2.2</td> </tr> </table>
Display lines of preformatted text. This works inline or as a block. No Creole markup is interpreted between these characters, even tildes which are used as escape characters (see section Escape Characters ). However the backslash escape character (\) of Txt2Site applies also to nowiki text.
As a block, the three curly braces should be on one line by itself to open and another line of three curly braces should be on a line by itself to close, without leading spaces.
{{{ //This// does **not** get [[formatted]] Type \${page_title} to display the page_title ~}}}
//This// does **not** get [[formatted]] Type ${page_title} to display the page_title
<pre> //This// does **not** get [[formatted]] Type ${page_title} to display the page_title </pre>
Some examples of markup are: {{{** <i>this</i> ** ~}}}
Some examples of markup are: ** <i>this</i> **
Some examples of markup are: <span>** <i>this</i> **</span>
To include closing braces where they might be considered as nowiki or preformatted end tag, there are two additional rules:
Inline nowiki with closing braces:
{{{ {{if (a>b) { b = a; }} }}}
{{if (a>b) { b = a; }}
{{{ if (x != NULL) { for (i = 0; i < size; i++) { if (x[i] > 0) { x[i]--; }}}
}}}
if (x != NULL) { for (i = 0; i < size; i++) { if (x[i] > 0) { x[i]--; }}}
The role of escape characters can be explained by considering the way the text is parsed. Parsing of content sections is carried out in two steps.
This step is optional and is carried out if the evaluation flag of the html_content_div function has the value 'eval'. The rules for escaping in this step is determined by bash. The escape character is the backslash (\). In short, it is important to know:
This step is processed by the converter which translates Creole syntax to XHTML syntax. The Creole specifications prescribes the tilde (~) as the escape character. Rules for escaping are:
#list item1 \\\ #list item2 \\\ ~#list item1 \\\ ~#list item2 \\\
#list item1
#list item2
use the escape character to stop \\\ ~{{{ \\\ nowiki blocks from being \\\ nowiki blocks \\\ ~}}}
use the escape character to stop
{{{
nowiki blocks from being
nowiki blocks
}}}
Examples how to use the tilde:
What you type | What you see |
---|---|
a tilde escapes itself: ~xxx | a tilde escapes itself: xxx |
a tilde alone: ~ | a tilde alone: ~ |
a tilde twice: ~~ | a tilde twice: ~ |
~{{~{ this is inline nowiki ~}}~} | {{{ this is inline nowiki }}} |
~{~{~{ this is inline nowiki ~}~}~} | {{{ this is inline nowiki }}} |
http://www.foo.com/~bar/ | http://www.foo.com/~bar/ |
~http://www.foo.com/ | http:www.foo.com/ |
**bold** normal | bold normal |
~**not bold~** normal | **not bold** normal |
~*~*not bold~*~* normal | **not bold** normal |
It is not forbidden to use HTML code within Creole text. But the code is treated as normal Creole text. Mostly the HTML code runs well, but it is not unimaginable that occasionally the code causes unpredictable results or does not meet the W3C web standards.
A plugin is available to insert HTML code in a save way.
The syntax of the plugin is: <<< HTML <lines of code> >>> . The plugin can be used inline or as a block. See the plugin section for more info about plugins.
The first example shows the case that pure HTML code runs well.
this is the first line <br/> this is the <strong> second </strong> line
this is the first line HTML
this is the second line
The following examples show the use of the HTML plugin.
<<< HTML <span style="padding: 10px; border: 1px solid blue; "> span with padding; this item is **not bold** </span> >>>
<<< HTML <hr style="background-color: red; height: 10px;" /> <!-- RED RULE --> >>>
<<< HTML <table class="table_creole" > <tr> <th>Heading Col 1</th> <th>Heading Col 2</th> </tr> <tr> <td>Cell 1.1</td> <td>Two lines<br />in Cell 1.2</td> </tr> <tr> <td>Cell 2.1</td> <td>Cell 2.2</td> </tr> </table> >>>
Heading Col 1 | Heading Col 2 |
---|---|
Cell 1.1 | Two lines in Cell 1.2 |
Cell 2.1 | Cell 2.2 |
TIP: To apply some special style, embed Creole syntax within a HTML div-element.
For example to create a border around an unordered list:
<<< HTML <div style="border: 1px solid blue;" > >>> # Item 1 ## Item 1.1 ## Item 1.2 # Item 2 <<< HTML </div> >>>
Creole syntax | What you see | HTML code |
---|---|---|
## monospace:iii Mmm ## | monospace:iii Mmm | <tt> monospace:iii Mmm </tt> |
AAA^^ superscript ^^ | AAA superscript | <sup> superscript </sup> |
AAA,, subscript ,, | AAA subscript | <sub> superscript </sub> |
__ underline __ | underline | <u> superscript </u> |
(TM) | ™ | ™ |
(R) | ® | ® |
(C) | © | © |
... | … | … |
-- | – | – |
:this is indented \\\ second indented line
this is indented
second indented line
<div style="margin-left: 2em"> <p> this is indented <br /> second indented line </p> </div>
This is a normal paragraph. \\\ :This is an indented \\\ paragraph in two lines. \\\ ::This is more indented.
This is a normal paragraph.
This is an indented
paragraph in two lines.
This is more indented.
<p> This is a normal paragraph. <br /> </p> <div style="margin-left: 2em"> <p> This is an indented <br /> paragraph in two lines. <br /> </p> <div style="margin-left: 2em"> <p> This is more indented. </p> </div> </div>
; Title 1 : Item 1.1 : Item 1.2 ; Title 2 : Item 2.1 \\\ Item 2.2 \\\ Item 2.3
<dl> <dt>Title 1</dt> <dd></dd> <dd>Item 1.1</dd> <dd>Item 1.2</dd> <dt>Title 2 </dt> <dd>Item 2.1 <br /> Item 2.2 <br /> Item 2.3</dd> </dl>
Creole 1.0 Additions supports two plugin syntaxes:
The Perl module Text::WikiCreole not only converts Creole to XHTML but also enables the user to add its own plugins. With Txt2Site the following plugins are supported:
In Creole linebreaks can be forced by \\\ .
An alternative syntax for forcing a linebreak is with this plugin.
Numbering macro: supports simple numbering.